
package com.insigma.business.qrcode.common.converter;

import com.insigma.business.qrcode.soldier.dto.SoldierUnemploymentRegistrationInfoDTO;
import com.insigma.business.qrcode.soldier.entity.SoldierUnemploymentRegistrationInfoDO;
import com.insigma.business.qrcode.soldier.request.SoldierUnemploymentRegistrationInfoSearchRequest;
import com.insigma.business.qrcode.soldier.request.SoldierUnemploymentRegistrationInfoBSearcher;
import com.insigma.business.qrcode.soldier.request.SoldierUnemploymentRegistrationInfoInsertRequest;
import com.insigma.business.qrcode.soldier.request.SoldierUnemploymentRegistrationInfoUpdateRequest;
import org.springframework.beans.BeanUtils;

import java.util.List;


public class SoldierUnemploymentRegistrationInfoProviderConverter extends AbstractConverter<SoldierUnemploymentRegistrationInfoDTO, SoldierUnemploymentRegistrationInfoDO> {

    private final static SoldierUnemploymentRegistrationInfoProviderConverter soldierUnemploymentRegistrationInfoConverter = new SoldierUnemploymentRegistrationInfoProviderConverter();

    private SoldierUnemploymentRegistrationInfoProviderConverter(){}

    
    public static SoldierUnemploymentRegistrationInfoBSearcher convertRequestSO2Searcher(final SoldierUnemploymentRegistrationInfoSearchRequest request){
        final SoldierUnemploymentRegistrationInfoBSearcher soldierUnemploymentRegistrationInfoBSearcher = new SoldierUnemploymentRegistrationInfoBSearcher(request.getPageNo(),
        request.getPageSize(),request.getSortKeyValueJoint());
        BeanUtils.copyProperties(request,soldierUnemploymentRegistrationInfoBSearcher);
        return soldierUnemploymentRegistrationInfoBSearcher;
    }

    
    public static SoldierUnemploymentRegistrationInfoDO convertRequestUO2DO(final SoldierUnemploymentRegistrationInfoUpdateRequest soldierUnemploymentRegistrationInfoUpdateRequest) {
        final SoldierUnemploymentRegistrationInfoDO soldierUnemploymentRegistrationInfoDO = new SoldierUnemploymentRegistrationInfoDO();
        BeanUtils.copyProperties(soldierUnemploymentRegistrationInfoUpdateRequest,soldierUnemploymentRegistrationInfoDO);
        
        return soldierUnemploymentRegistrationInfoDO;
    }

    
    public static SoldierUnemploymentRegistrationInfoDO convertRequestIO2DO(final SoldierUnemploymentRegistrationInfoInsertRequest soldierUnemploymentRegistrationInfoInsertRequest) {
        final SoldierUnemploymentRegistrationInfoDO soldierUnemploymentRegistrationInfoDO = new SoldierUnemploymentRegistrationInfoDO();
        BeanUtils.copyProperties(soldierUnemploymentRegistrationInfoInsertRequest,soldierUnemploymentRegistrationInfoDO);
        return soldierUnemploymentRegistrationInfoDO;
    }

    
    public static List<SoldierUnemploymentRegistrationInfoDTO> convertResponseDOList2DTOList(final List<SoldierUnemploymentRegistrationInfoDO> soldierUnemploymentRegistrationInfoDOList){
        return soldierUnemploymentRegistrationInfoConverter.convertGenericResponseDOList2DTOList(soldierUnemploymentRegistrationInfoDOList);
    }

    
    public static SoldierUnemploymentRegistrationInfoDTO convertResponseDO2DTO(final SoldierUnemploymentRegistrationInfoDO soldierUnemploymentRegistrationInfoDO){
        return soldierUnemploymentRegistrationInfoConverter.convertGenericResponseDO2DTO(soldierUnemploymentRegistrationInfoDO);
    }

    
    @Override
    protected SoldierUnemploymentRegistrationInfoDTO doConvertResponseDO2DTO(SoldierUnemploymentRegistrationInfoDO soldierUnemploymentRegistrationInfoDO) {
        final SoldierUnemploymentRegistrationInfoDTO soldierUnemploymentRegistrationInfoDTO = new SoldierUnemploymentRegistrationInfoDTO();
        try {
            BeanUtils.copyProperties(soldierUnemploymentRegistrationInfoDO, soldierUnemploymentRegistrationInfoDTO);
        }catch(RuntimeException be){
            
            return null;
        }
        return soldierUnemploymentRegistrationInfoDTO;
    }

}
